from rest_framework import serializers

from goods.models import SKU


class OrderSerializer(serializers.ModelSerializer):
    count = serializers.IntegerField(read_only=True)

    class Meta:
        model = SKU
        fields = "__all__"


class OrdersSerializer(serializers.Serializer):
    """运费信息处理"""
    skus = OrderSerializer(many=True)
    freight = serializers.DecimalField(max_digits=10, decimal_places=2)
    # max_degits表示最大存储位数，　后者表示最多保留几位小数
